#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
# author: 小菠萝测试笔记
# blog:  https://www.cnblogs.com/poloyy/
# time: 2021/10/10 12:10 下午
# file: setting.py
"""
import os
import secrets

from pydantic import BaseSettings


class Settings(BaseSettings):
    api_v1_sre: str = "/api/v1"
    project_name: str = "polo_test_platform"
    # 60 minutes * 24 hours * 8 days = 8 days
    access_token_expire_minutes: int = 60 * 24 * 8
    secret_key: str = secrets.token_urlsafe(32)
    host: str = os.getenv("host")

    mysql_host: str = host
    mysql_port: int = 3306
    mysql_username: str = "root"
    mysql_password: str = "123456"
    mysql_dbname: str = "polo_test_platform"
    sqlalchemy_database_uri: str = f"mysql+pymysql://{mysql_username}:{mysql_password}@{mysql_host}:{mysql_port}/{mysql_dbname}"

    redis_host: str = host
    redis_port: int = 6379
    redis_port_expire_seconds: int = 60 * 10

    class Config:
        case_sensitive = True


settings = Settings()
